
#仅限位置传参
def pos_only_arg(arg, /):
    print(arg)

pos_only_arg(1)
# pos_only_arg(a=2) # TypeError: pos_only_arg() takes 1 positional argument but 2 were given

def kwd_only_arg(*, arg):
    print(arg)

kwd_only_arg(arg=3)
# kwd_only_arg(4) # TypeError: kwd_only_arg() takes 0 positional arguments but 1 was given

# *args 会收集所有传入的位置参数（没有名字的参数）到一个元组中
def concat(*args, sep="/"):
    return sep.join(args)
print(concat("earth", "mars", "venus"))
print(concat("earth", "mars", "venus", sep="."))
# print(concat(1,2,3, sep=".")) #报错

